// LogView.cpp : implementation file
//

#include "stdafx.h"
#include "Chat.h"
#include "LogView.h"


// CLogView

IMPLEMENT_DYNCREATE(CLogView, CListView)

CLogView::CLogView()
{

}

CLogView::~CLogView()
{
}

BEGIN_MESSAGE_MAP(CLogView, CListView)
END_MESSAGE_MAP()


// CLogView diagnostics

#ifdef _DEBUG
void CLogView::AssertValid() const
{
	CListView::AssertValid();
}

#ifndef _WIN32_WCE
void CLogView::Dump(CDumpContext& dc) const
{
	CListView::Dump(dc);
}
#endif
#endif //_DEBUG


// CLogView message handlers

void CLogView::OnInitialUpdate()
{
	CListView::OnInitialUpdate();

	// TODO: Add your specialized code here and/or call the base class
	GetListCtrl().ModifyStyle(0, LVS_REPORT);
	GetListCtrl().InsertColumn(0, _T("Date"), LVCFMT_LEFT, 150);
	GetListCtrl().InsertColumn(1, _T("Log"), LVCFMT_LEFT, 400);
	
}

void CLogView::WriteLog( TCHAR* pLog )
{
	CString strTime = CTime::GetCurrentTime().Format(_T("%Y-%m-%d %H:%M:%S"));
	int item = GetListCtrl().InsertItem(GetListCtrl().GetItemCount(), strTime);
	GetListCtrl().SetItem(item, 1, LVIF_TEXT, pLog, 0, 0, 0, 0);
}